package com.compass.mobile.presenters

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.leanback.widget.Presenter
import com.compass.mobile.R
import com.compass.mobile.models.Title

/**
 * Description： 预约日期presenter
 * Date:2024/5/23 16:12
 */
class DatePresenter : Presenter() {
    private var finalWidth: Int? = null
    fun setFinalWidth(finalWidth: Int?) {
        this.finalWidth = finalWidth
    }

    override fun onCreateViewHolder(viewGroup: ViewGroup): ViewHolder {
        val view = LayoutInflater.from(viewGroup.context)
            .inflate(R.layout.item_date, viewGroup, false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any) {
        if (item is Title) {
            val vh = viewHolder as ViewHolder
            vh.tvTitle.text = item.name
            vh.tvDate.text = item.value
        }
    }

    override fun onUnbindViewHolder(viewHolder: Presenter.ViewHolder) {

    }


    class ViewHolder(view: View) : Presenter.ViewHolder(view) {
        var tvTitle: TextView
        var tvDate: TextView


        init {
            tvTitle = view.findViewById(R.id.tv_title)
            tvDate = view.findViewById(R.id.tvDate)

        }
    }
}
